package cn.jiyun.redis.controller;

import cn.jiyun.redis.pojo.Emp;
import cn.jiyun.redis.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;
import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpService empService;
    @RequestMapping("/findAll")
    @CrossOrigin(allowedHeaders = "*")
    public List<Emp> findAll(){
        return empService.findAll();
    }
    @RequestMapping("/dian")
    @CrossOrigin(allowedHeaders = "*")
    public void dian(String name) throws UnknownHostException {
        empService.dian(name);
    }
}
